﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

namespace xbUI
{
    public delegate void OnConfirm();

    public class Dialog1 : MonoBehaviour
    {
        [SerializeField] private Text title;
        [SerializeField] private Text content;

        // 定义变量保存函数
        public OnConfirm onConfirmEvent;

        void Start()
        {

        }

        void Update()
        {

        }

        public string Title
        {
            get
            {
                return title.text;
            }
            set
            {
                title.text = value;
            }
        }

        public string Content
        {
            get
            {
                return content.text;
            }
            set
            {
                content.text = value;
            }
        }

        public void OnConfirm()
        {
            gameObject.SetActive(false);
            if (onConfirmEvent != null)
            {
                onConfirmEvent();
            }
        }

        public void SetCallfunc(OnConfirm callfunc)
        {
            onConfirmEvent = callfunc;
        }
    }
}
